﻿using Huayou.Common.Database;
using Huayou.Utils;
using HySoft.Cash.BaseClass;
using HySoft.Cash.DB;
using HySoft.Cash.Structure;
using System;
using System.Data;
using System.Web.UI;

namespace HySoft.Cash.Business
{
    public class ReportSettingsBN: BaseBusiness
    {
        private ReportSettingsDB db;

        public ReportSettingsBN(Page page) : base(page)
        {
            this.db = null;
            this.db = new ReportSettingsDB(base.curDBOperater);
        }

        public ReportSettingsBN(Page page, DBOperate oper)
            : base(page, oper)
        {
            this.db = null;
            this.db = new ReportSettingsDB(base.curDBOperater);
        }


        public bool OperateReportSettingsClient(ReportSettingsClientDT detail)
        {
            return this.db.OperateReportSettings<ReportSettingsClientDT>(detail);
        }

        public bool OperateReportSettingsInvoice(ReportSettingsInvoiceDT detail)
        {
            return this.db.OperateReportSettings<ReportSettingsInvoiceDT>(detail);
        }

        public bool OperateReportSettingsPayment(ReportSettingsPaymentDT detail)
        {
            return this.db.OperateReportSettings<ReportSettingsPaymentDT>(detail);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        /// <remarks>如果要获取管理员的设置，请给userID传入0</remarks>
        public ReportSettingsClientDT GetReportSettingsClient(int userID)
        {
            return this.db.GetReportSettings<ReportSettingsClientDT>(userID);
        }

        public ReportSettingsInvoiceDT GetReportSettingsInvoice(int userID)
        {
            return this.db.GetReportSettings<ReportSettingsInvoiceDT>(userID);
        }

        public ReportSettingsPaymentDT GetReportSettingsPayment(int userID)
        {
            return this.db.GetReportSettings<ReportSettingsPaymentDT>(userID);
        }
	}
}
